<?php require_once(dirname(__FILE__)."/../core/safeParam.php");

$where = "";
if(isset($_GET['id']) && $_GET['id'] != ""){
  $where = ' AND  id = "'.$_GET['id'].'" ';	
}

$allpizzas= $database->select("SELECT * FROM pizza where rid = ".RID." order by size");
$pizzas= $database->select("SELECT * FROM pizza where rid = ".RID." ".$where." order by size");

for($i=0; $i<count($pizzas); $i++){
  
  $pizzas[$i]['toppings'] = explode(",",trim($pizzas[$i]['toppings']));
  $pizzas[$i]['meat_toppings'] = explode(",",trim($pizzas[$i]['meat_toppings']));
  $pizzas[$i]['topoff'] = explode(",",trim($pizzas[$i]['topoff']));
  $pizzas[$i]['base'] = explode(",",trim($pizzas[$i]['base']));
  $pizzas[$i]['sauce'] = explode(",",trim($pizzas[$i]['sauce']));
  $pizzas[$i]['sides'] = unserialize($pizzas[$i]['sides']);
  $topping_prices[$i] = price_format($pizzas[$i]['topping_price']);
  
}



$smarty->assign("who_for",getOption('cb-who-for',RID));
$smarty->assign("pizzas",$pizzas);
$smarty->assign("pizza",$pizzas[0]);
$smarty->assign("allpizzas",$allpizzas);

$topping_price = implode(",",$topping_prices);
$smarty->assign("topping_prices",$topping_price);

?>
